package com.jiangli.mapper;

import com.jiangli.entity.Ingredient;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import com.sky.entity.DishIngredient;
import java.util.List;

@Mapper
public interface IngredientMapper {

    List<String> getIngredientIdWithDishId(Integer id);

    @Select("select * from jiangli_breath.ingredient where id = #{id}")
    Ingredient getIngredientWithId(Long id);

    List<Ingredient> getIngredientsByIds(List<Long> missIds);


    List<Ingredient> selectAllAvailable();

    List<String> getDishIdWithIngredientId(Long id);

    void addIngredient(Ingredient ingredient);

    void updateIngredient(Ingredient ingredient);

    void addDishIngredient(List<DishIngredient> dishIngredient);

    void deleteConectionByDishId(Long dishId);

    List<Ingredient> getIngredientsByName(String ingredientName);

    @Select("SELECT COUNT(*)" +
            "FROM ingredient" +
            "WHERE name = #{name}; ")
    int selectByName(String name);
}
